﻿//===============================ChartForm.cs==============================\\
//===Bart Steijlen======\\


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;

using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;



namespace Team2_Vision
{
    public partial class Chart : Form
    {

        
        public int[] y;
        public Chart(int[]yas)
        {
            InitializeComponent();
            
            y = yas;
        }


        public void Chart_Load(object sender, EventArgs e)
        {  

            
            this.chart1.Palette = ChartColorPalette.SeaGreen;

            
            this.chart1.Titles.Add("Histogram");

            

            Series series = this.chart1.Series.Add("HistoGram");
            for (int i = 0; i < 256; i++)
            {
               
                

               
                series.Points.Add(y[i]);
            }
            
        }

        private void chart1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            
            SaveFileDialog sv = new SaveFileDialog();
            sv.ShowDialog();
            String filename = sv.FileName;
            String Directory = sv.InitialDirectory;
            String extensie = ".Jpeg";            
            this.chart1.SaveImage(Directory+filename+extensie, ChartImageFormat.Jpeg);
            
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((comboBox1.Text) == "SeaGreen")
            {
                this.chart1.Palette = ChartColorPalette.SeaGreen;
            }
            if ((comboBox1.Text) == "GrayScale")
            {
                this.chart1.Palette = ChartColorPalette.Grayscale;
            }
            if ((comboBox1.Text) == "Chocolate")
            {
                this.chart1.Palette = ChartColorPalette.Chocolate;
            }
            if ((comboBox1.Text) == "Berry")
            {
                this.chart1.Palette = ChartColorPalette.Berry;
            }
            if ((comboBox1.Text) == "Bright")
            {
                this.chart1.Palette = ChartColorPalette.Bright;
            }
            if ((comboBox1.Text) == "BrightPastel")
            {
                this.chart1.Palette = ChartColorPalette.BrightPastel;
            }
            if ((comboBox1.Text) == "EarthTones")
            {
                this.chart1.Palette = ChartColorPalette.EarthTones;
            }
            if ((comboBox1.Text) == "Excel")
            {
                this.chart1.Palette = ChartColorPalette.Excel;
            }
            if ((comboBox1.Text) == "Fire")
            {
                this.chart1.Palette = ChartColorPalette.Fire;
            }
            if ((comboBox1.Text) == "Light")
            {
                this.chart1.Palette = ChartColorPalette.Light;
            }
            if ((comboBox1.Text) == "Pastel")
            {
                this.chart1.Palette = ChartColorPalette.Pastel;
            }
            if ((comboBox1.Text) == "SemiTransparant")
            {
                this.chart1.Palette = ChartColorPalette.SemiTransparent;
            }
            if ((comboBox1.Text) == "None")
            {
                this.chart1.Palette = ChartColorPalette.None;
            }
            
              
            
        }
    }
}
